﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpModelInterface.h"
#include "IExternalObject.h"
#include "NdbDataSchema.h"
#include "GbmpQuickCast.h"
#include "ElementCreationOptions.h"
namespace gcmp
{
    class IFillPatternData;
    class IDocument;
    

    /// \brief  填充模式元素接口类
    ///
    class GCMP_MODEL_INTERFACE_EXPORT IFillPattern : public IExternalObject
    {
        DEFINE_CAST_DERIVED(gcmp::IFillPattern, gcmp::IExternalObject);
    public:      

        /// \brief 在文档中创建填充模式元素
        /// \param pDocument 当前文档
        /// \param pFillPatternData 填充模式
        /// \param overrideIfNameRepeat 如果填充与文档中已有填充重名，是否要覆盖
        /// \param fillPatternName 填充样式名字，如果为空，则使用 pFillPatternData 里的填充图案名字
        /// \return 填充模式元素
        static IFillPattern* Create(IDocument* pDocument, OwnerPtr<IFillPatternData> pFillPatternData, bool overrideIfNameRepeat, const std::wstring& fillPatternName = L"", ElementCreationOptions eco = ElementCreationOptions::Normal);

        /// \brief 在文档中创建填充模式元素
        /// \param pDocument 当前文档
        /// \param pFillPattern 填充模式
        /// \return 填充模式元素
        GCMP_OBSOLETE_API(2021/11/01, IFillPattern::Create(IDocument*, OwnerPtr<IFillPatternData>, bool)) static IFillPattern* Create(IDocument* pDocument, OwnerPtr<IFillPatternData> pFillPattern);     

        /// \brief 通过填充模式名称得到填充模式元素
        /// \param pDocument 当前文档
        /// \param fillPatternName 填充模式名称
        /// \return 填充模式元素
        static IFillPattern* GetFillPatternByName(const IDocument* pDocument, const std::wstring& fillPatternName);     

        /// \brief 获取Implementation Uid
        ///
        /// \return UniIdentity 返回ImplementationUid
        static const  UniIdentity& GetImplementationUid();

        /// \brief 从获取填充模式
        /// \return 填充格式
        virtual const IFillPatternData* GetFillPatternData() const = 0;     

        /// \brief 设置获取填充模式
        /// \return opFillPattern 填充格式
        virtual void SetFillPatternData(OwnerPtr<IFillPatternData> opFillPattern) = 0;
    
        /// \brief 获取填充样式名字
        /// \return 填充样式名字
        virtual const std::wstring& GetName() const = 0;

        /// \brief 设置填充样式名字
        /// \return 设置成功返回true，失败（重名、为空）返回false
        virtual bool SetName(const std::wstring& name) = 0;
    };
}



